﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for MonthCard
/// </summary>
public class MonthCard
{
    #region Public Properties
    public Guid ID { get; set; }
    public string PlateNumber { get; set; }
    public PlateType PlateType { get; set; }
    public CarColor CarColor { get; set; }
    public ParkingFloor ParkingFloor { get; set; }
    public Customer Customer { get; set; }
    public DateTime FromDate { get; set; }
    public DateTime ToDate { get; set; }
    public DateTime IsExpired { get; set; }
    public int Price { get; set; }
    public bool Active { get; set; }
    public Employee LastUser { get; set; }
    public DateTime LastUpdate { get; set; }
    public MonthCardHistory MonthCardHistory { get; set; }
    #endregion
	public MonthCard()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public List<MonthCard> GetAll()
    {
        return MonthCardDAL.GetAll();
    }

    public MonthCard GetById(Guid id)
    {
        return MonthCardDAL.GetById(id);
    }

    public bool IsExistedPlateNumber(string plateNumber, Guid id)
    {
        return MonthCardDAL.IsExistedPlateNumber(plateNumber, id);
    }

    public bool Insert(MonthCard monthCard)
    {
        return MonthCardDAL.Insert(monthCard);
    }

    public bool Update(MonthCard monthCard)
    {
        return MonthCardDAL.Update(monthCard);
    }

    public bool Renew(MonthCard monthCard)
    {
        return MonthCardDAL.Renew(monthCard);
    }

    public bool Delete(Guid id)
    {
        return MonthCardDAL.Delete(id);
    }

    //public List<MonthCard> Search(MonthCard monthCard)
    //{
    //    return MonthCardDAL.Search(monthCard);
    //}

    /// <summary>
    /// ActiveAction
    /// </summary>
    /// <param name="emp">Employee</param>
    /// <returns>bool</returns>
    public bool ActiveAction(MonthCard month)
    {
        try
        {
            //switch active
            if (month.Active)
                month.Active = false;
            else
                month.Active = true;

            return MonthCardDAL.ActiveAction(month);
        }
        catch (Exception)
        {
            throw;
        }
    }
}
